package com.ly.service.impl;

import com.ly.mapper.DeptMapper;
import com.ly.pojo.SysDept;
import com.ly.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<SysDept> getPaging(SysDept sysDept, Integer pageNo, Integer pageSize) {
        //计算起始索引
        Integer startIndex = (pageNo - 1) * pageSize;

        return deptMapper.getPaging(sysDept, startIndex, pageSize);
    }

    @Override
    public Integer getCount(SysDept sysDept) {
        return deptMapper.getCount(sysDept);
    }

    @Override
    public Integer add(SysDept sysDept) {
        return deptMapper.add(sysDept);
    }

    @Override
    public SysDept getById(Integer id) {
        return deptMapper.getById(id);
    }

    @Override
    public Integer delete(Integer id) {
        return deptMapper.delete(id);
    }

    @Override
    public Integer update(SysDept sysDept) {
        return deptMapper.update(sysDept);
    }
}
